import Vue from "vue";
import Vuex from "vuex";

import getters from './getters';

import baseInfo from './modules/baseInfo';
import trade from './modules/trade';

import storage from "@/utils/storage";

Vue.use(Vuex);

const store = new Vuex.Store({

  mutations: {
    login(state, userInfo) {
      state.userInfo = userInfo || {};
      state.userName =
        userInfo.Name || userInfo.Nickname || userInfo.Username || "匿名用户";
      state.hasLogin = true;
    },
    logout(state) {
      state.userName = "";
      state.hasLogin = false;
    },

    // 设置填写订单中备注
    setRemark(state, remark) {
      state.remark = remark;
    }
  },
  actions: {},
});

export default new Vuex.Store({
  modules: {
    baseInfo,
    trade
  },
  getters,
});
